package com.yang.mall.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yang.mall.dto.ProductSortDTO;
import com.yang.mall.entity.OLResponse;
import com.yang.mall.entity.ProductSort;
import com.yang.mall.service.IProductSortService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 商品分类表 前端控制器
 * </p>
 *
 * @author kadorlin
 * @since 2022-10-21
 */
@Api(tags = "【小程序】商品分类模块")
@RestController
@RequestMapping("/h5/productSort")
@CrossOrigin(origins = "*", methods = {RequestMethod.POST, RequestMethod.GET, RequestMethod.OPTIONS})
public class ProductSortController {

    @Resource
    private IProductSortService productSortService;


    @ApiOperation("查询分类(页page)")
    @GetMapping("/querySort")
    public OLResponse<IPage<ProductSort>> querySort(ProductSortDTO productSortDTO){
        return new OLResponse().success(productSortService.querySort(productSortDTO));
    }

    @ApiOperation("获取分类list")
    @GetMapping("/pullSort")
    public OLResponse pullSort(ProductSortDTO productSortDTO){
        return new OLResponse().success(productSortService.pullSort(productSortDTO.getSortId()));
    }

}
